<template>
	<!-- 添加弹框 -->
		<el-dialog  width="50%" title=""   visible :show-close="false" :modal-append-to-body="false" class="wrap" @close="cancel" :close-on-click-modal="false">
		<i class="el-icon-close close" @click="cancel" style="color: white;"></i>
	    <div class="bt">添加新闻</div>
		<el-form label-width="100px"  class="form">
			<el-form-item label="主题" class="select-block">
				<el-input v-model="title" placeholder="请输入班级名称" icon="add"  ></el-input>
			</el-form-item>
			<el-form-item label="资料标签" class="select-block">
				<el-input v-model="bq1" placeholder="请输入班级名称" icon="add"  ></el-input>
			</el-form-item>
			<el-form-item label="内容介绍" class="select-block">
				<el-input v-model="note" placeholder="请输入班级名称" icon="add"  ></el-input>
			</el-form-item>
			<el-button type="primary" class="submit" @click="submit">保存</el-button>
			<BqComponent v-if="portComponents.bq.toggle" @close="componentsHide" :params="portComponents.bq.params"></BqComponent>
		</el-form>
		<!-- </el-dialog> -->
	</el-dialog>
</template>
<script type="text/javascript">
import BqComponent from '../../admin/xxjbszManage/bq'
	import qs from 'qs'
	export default {
		props: ['params'],
		components: {BqComponent },
		data() {
			return {
				title:'',
				bq1:'',
				note:'',
				portComponents: {
					bq: {
						type: 'bq',
						toggle: false,
						params: '',
						data: {}
					},
				}
			}
		},
		created() {
		},
		methods: {
			delbq(bq){
				var dd =[];
					for ( let i in this.bqList ) {
						if (this.bqList[i]==bq){
							continue}else{
							 dd.push(this.bqList[i]);
						}
					}
					this.bqList= dd;
			 },




			submit() {
				this.$store.state.loading = true;
				var logininfo = JSON.parse(localStorage.logininfo);
				var params3 = qs.stringify({
					bq:this.bq1+'',
					url:'1231sdsad',
					fz:'A',
					yh:logininfo.id+'',
					fm:111,
					ywyh:'00',
					jsr:'11',
					isfb:'Y',
					issy:'Y',
					title:this.title,
					note:this.note,
					fbtime:'2018-10-10',
					yhid: logininfo.id,
					xxid: logininfo.xxid,
				});
				//执行
				this.axios.post(this.$store.state.api + 'yxxw/insert', params3)
					.then(res => {
						if(res.data.code == 1) {
							this.$emit('close', { type: 'add', cancel: false });
							this.$store.state.loading = false;
						} else {
							this.$emit('close', { type: 'add', cancel: false });
							this.$store.state.loading = false;
						}
					}).catch(res => {
						this.$message.warning("服务器繁忙，请重试");
						//this.$emit('close', { type: 'add', cancel: false });
						this.$store.state.loading = false;
					})
			},



			cancel() {
				this.$emit('close', { type: 'add', cancel: true })
			},
			componentsShow (type,data) { //显示组件
								console.log(type,data)
								for ( let i in this.portComponents ) {
										if (type == this.portComponents[i].type) {
												this.portComponents[i].toggle = true;
												this.portComponents[i].params = data;
												if (this.portComponents[i].data.type == 'single') {
														this.portComponents[i].data.index = data.row.id
												}else if(this.portComponents[i].data.type == 'multiple'){
														this.portComponents[i].data.index = this.multipleDelNum;
												}else{
														return;
												}
												return;
										}
								}
						},
						componentsHide (setting) { //关闭组件
								for ( let i in this.portComponents ) {
										if (setting.type == this.portComponents[i].type) {
											 this.portComponents[i].toggle = false;
											 if (this.portComponents[i].type=='bq'){
													if (!setting.cancel) {
														 for ( let b in setting.clist ) {

													 this.bqList.push( setting.clist[b]);
													}

													}
											 }else{
												if (!setting.cancel) {
												}
											 }
											 return;
										}
								}
						}
		}
	}
</script>
<style lang="less" scoped >
	.wrap {
		.row{
			height:50px;
			line-height: 50px;
		}
		.bt{
			position: absolute;
			width: 100%;
			height: 50px;
			margin: 0 auto;
			top: 0;
			left: 0;
			// margin-top: -70px;
			background: #50BFFF;
			// margin-left: -20px;
			// margin-bottom: 20px;
			color:white;
			text-align:left;
			line-height: 50px;
			font-size: 17px;
			padding-left: 15px;
		}
		.close{
				z-index: 10;
				position: absolute;
		}
		.input-block {
			margin-bottom: 20px;
			text-align: center;
		}
		.input {
			width:280px;
			display: inline-block;
			margin-left: 10px;
		}
		.input1 {
			width: 210px;
			display: inline-block;
			margin-left: 10px;
		}
		.input-block span {
			display: inline-block;
			width: 70px;
			text-align: right;
		}
		.submit {
			width: 120px;
			display: block;
			// float: left;
			margin: 0 auto;
			margin-top: 20px;
		}
		.wpfl {
			// background: red;
			// position: absolute;
			// top: 20%;
			// left: -10%;
		}
		.lskb {
			width: 130%;
			background: #fff;
			position: absolute;
			top: 5px;
			left: -66px;
			z-index: 50;
		}
		.wpfl1 {
			width: 130%;
			background: #fff;
			position: absolute;
			top: 5px;
			left: -66px;
		}
		.form {
			margin-top: 20px;
			.select-block {
				width: 45%;
				// display: block;
			}
			.select-block1 {
				width: 68%;
				// display: block;
			}
			.weekdiv{
				width: 100%;
				height: 100%;
				margin: 0 auto;
				background: lightblue;


			}
			.wdiv0 {
				line-height: 45px;
				width: 100px;
				height: 300px;
				float: left;
				background: lightgoldenrodyellow;
			}
			.wdiv1 {
				width: 40px;
				height: 300px;
				float: left;
				background: lightgoldenrodyellow;
			}
			.wdiv2 {
				width: 40px;
				height: 300px;
				float: left;
				background: lightgoldenrodyellow;
			}
			.wdiv3 {
				width: 40px;
				height: 300px;
				float: left;
				background: lightgoldenrodyellow;
			}
			.wdiv4 {
				width: 40px;
				height: 300px;
				float: left;
				background: lightgoldenrodyellow;
			}
			.wdiv5 {
				width: 40px;
				height: 300px;
				float: left;
				background: lightgoldenrodyellow;
			}
			.wdiv6 {
				width: 40px;
				height: 300px;
				float: left;
				background: lightgoldenrodyellow;
			}
			.wdiv7 {
				width: 40px;
				height: 300px;
				float: left;
				background: lightgoldenrodyellow;
			}
			.el-checkbox+.el-checkbox {
     margin-left: 0px;
}
		}


	}

</style>
